package com.wigem.approve.controller;

import com.wigem.framework.common.pojo.PageResult;
import com.wigem.framework.common.util.web.response.Result;
import com.wigem.approve.entity.GeApproveLogEntity;
import com.wigem.approve.service.GeApproveLogService;
import com.wigem.approve.vo.GeApproveLogVo;
import com.wigem.framework.common.util.web.response.ResultController;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 【审批日志】Controller
 *
 * @author YMY
 * @date 2023-08-09
 */
@RestController
@RequestMapping("/approve/approveLog")
public class GeApproveLogController extends ResultController {


    @Resource
    private GeApproveLogService geApproveLogService;

    /**
     * 查询【审批日志】列表
     */
    @ResponseBody
    @GetMapping("/query")
    public Result getList(GeApproveLogVo geApproveLogVo) {

        return success(geApproveLogService.getList(geApproveLogVo));
    }

    /**
     * 查询【审批日志】列表
     */
    @ResponseBody
    @GetMapping("/query/page")
    public Result getPageList(GeApproveLogVo geApproveLogVo) {
        PageResult<GeApproveLogEntity> pageInfo = geApproveLogService.getPageList(geApproveLogVo);
        return success(pageInfo);
    }

    /**
     * 查询【审批日志】实体
     */
    @ResponseBody
    @GetMapping("/query/{id}")
    public Result getEntity(@PathVariable("id") String id) {
        return success(geApproveLogService.getEntity(id));
    }


    /**
     * 【审批日志】新增
     */
    @ResponseBody
    @PostMapping
    public Result add(@RequestBody GeApproveLogVo geApproveLogVo) {
        geApproveLogService.add(geApproveLogVo);
        return success("保存成功");
    }

    /**
     * 【审批日志】修改
     */
    @ResponseBody
    @PutMapping
    public Result update(@RequestBody GeApproveLogVo geApproveLogVo) {
        geApproveLogService.update(geApproveLogVo);
        return success("修改成功");
    }


    /**
     * 新增保存
     */
    @ResponseBody
    @PostMapping("/save")
    public Result save(@RequestBody GeApproveLogVo geApproveLogVo) {
        geApproveLogService.save(geApproveLogVo);
        return success("保存成功！");
    }


    /**
     * 删除
     */
    @ResponseBody
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") String id) {
        geApproveLogService.delete(id);
        return success("删除成功！");
    }

    /**
     * 移除/逻辑删除
     */
    @ResponseBody
    @DeleteMapping("/remove/{id}")
    public Result remove(@PathVariable("id") String id) {
        geApproveLogService.remove(id);
        return success("删除成功！");
    }
}
